package com.zatech.cgnci.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zatech.cgnci.project.base.utils.ConvertUtils;
import com.zatech.cgnci.project.entity.CgnciSpecialConditionDO;
import com.zatech.cgnci.project.mapper.CgnciSpecialConditionMapper;
import com.zatech.cgnci.project.service.CgnciSpecialConditionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zatech.cgnci.project.vo.CgnciSpecialConditionVO;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 特约条件表 服务实现类
 * </p>
 *
 * @author Generator
 * @since 2024-12-17
 */
@Service
public class CgnciSpecialConditionServiceImpl extends ServiceImpl<CgnciSpecialConditionMapper, CgnciSpecialConditionDO> implements CgnciSpecialConditionService {

    @Override
    public CgnciSpecialConditionVO getSpecialCondition(Long insuranceId, String type) {
        CgnciSpecialConditionDO specialConditionDO = this.getOne(new LambdaQueryWrapper<CgnciSpecialConditionDO>()
                .eq(CgnciSpecialConditionDO::getBusinessId, insuranceId)
                .eq(CgnciSpecialConditionDO::getConditionType, type));
        return ConvertUtils.convert(specialConditionDO, CgnciSpecialConditionVO.class);
    }
}
